#include<stdio.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>                                                                                                                                     
#include<unistd.h>
#include<string.h>
int main(){
  umask(0);
  int fd=open("log.txt",O_CREAT | O_WRONLY |O_TRUNC,0666);
  if(fd<0){
    perror("open");
    return 1;
  }
  printf("fd: %d\n",fd);
  const char * msg="hello \n";
  int a =1234567;
  int cnt=5;
  while(cnt--){
    write(fd,msg,strlen(msg));
    char buffer[16];
    snprintf(buffer,sizeof(buffer),"%d",a);
  }

  close(fd);
  return 0;
}
